Currency Converter
This Template was Downloaded From GrabTemplates.com
By: Sitebase
Email: wim@sitebase.be
Table of Contents
A. Features
This PHP class is a multilingual currency converter for over 80 currencies. It uses daily updated exchange rates so the conversions are always correct. This class can for example be used in an online shop to automatic convert prizes of your products to an other currencie.
Below you find a list of supported currencies:
- AED: U.A.E. Dirham
- ANG: Netherland Antilles Guilder
- ARS: Argentine Peso
- AUD: Australian Dollar
- BGN: Bulgarian levs
- BHD: Bahraini Dinar
- BND: Brunei Dollar
- BRL: Brazil Real
- BWP: Botswana Pula
- CAD: Canadian Dollar
- CHF: Swiss Franc
- CLP: Chilean Peso
- CNY: China Renminbi
- COP: Colombian Peso
- CRC: Costa Rica Colon
- CZK: Czech Koruna
- DKK: Danish Krone
- DOP: Dominican Republic
- DZD: Algerian Dinar
- EEK: Estonian Kroon
- EGP: Egyptian Pound
- EUR: European Euro
- FJD: Fiji Dollar
- GBP: British Pound
- HKD: Hong Kong Dollar
- HNL: Honduras Lempira
- HRK: Croatian Kuna
- HUF: Hungarian Forint
- IDR: Indonesian Rupiah
- ILS: Israeli Shekel
- INR: Indian Rupee
- ISK: Iceland Krona
- JMD: Jamaica Dollar
- JOD: Jordanian Dinar
- JPY: Japanese Yen
- KES: Kenyan Shilling
- KRW: South Korean Won
- KWD: Kuwaiti Dinar
- KYD: Cayman Islands
- KZT: Kazakhstan Tenge
- LBP: Lebanese Pound
- LKR: Sri Lankan Rupee
- LTL: Lithuanian Lit
- LVL: Latvian Lat
- MAD: Moroccan Dirham
- MDL: Moldova Lei
- MUR: Mauritius Rupee
- MXN: Mexican pesos
- MYR: Malaysian Ringgit
- NGN: Nigeria Naira
- NOK: Norwegian Krone
- NZD: New Zealand Dollar
- OMR: Omani Rial
- PEN: Peruvian New Sol
- PGK: Papua New Guinea Kina
- PHP: Philippines Peso
- PKR: Pakistani Rupee
- PLN: Polish zloty
- PYG: Paraguay Guarani
- QAR: Qatari Riyal
- RON: Romanian leu
- RUB: Russian Ruble
- SAR: Saudi Riyal
- SCR: Seychelles Rupee
- SEK: Swedish Krona
- SGD: Singapore Dollar
- SKK: Slovakia Koruna
- SLL: Sierra Leone Leone
- SVC: El Salvador Colon
- THB: Thai Baht
- TND: Tunisian Dinar
- TRY: Turkish liras
- TTD: Trinidad/tobago Dollar
- TWD: Taiwan Dollar
- TZS: Tanzanian Shilling
- UAH: Ukraine Hryvna
- UGX: Ugandan Shilling
- USD: United States Dollar
- UZS: Uzbekistan Sum
- VEB: Venezuelan Bolivar
- VND: Vietnam Dong
- YER: Yemeni Rial
- ZAR: South African Rand
- ZMK: Zambian Kwacha
B. How to use
Extract all the files form the zip. The file you need to include in your script is CurrencyConverter.php. Next thing to do is create an instance of this class.
This Template was Downloaded From GrabTemplates.com
include("CurrencyConverter.php");
$CurrencyConverter = new CurrencyConverter();
If you want to convert euro's to dollar's you need the shorttag's for this currencies. This shorttags can be found in the list under the features categorie. For euro's is this EUR and for dollar's is this USD.
Now we can use the Convert method to do the calculation. The method Convert accepts 3 parameters. The first parameter is the source currency, second parameter is the destination currency and the last parameter is the value you want to convert.
This Template was Downloaded From GrabTemplates.com
echo $CurrencyConverter->Convert("EUR", "USD", 500);
C. Cache data
If you want you can eneable caching so the data is stored once a day in a local file. This will reduce the page load time and server load. To eneable caching you add a filename to the constructor.
This Template was Downloaded From GrabTemplates.com
$CurrencyConverter = new CurrencyConverter('mycachefile.tmp');